<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>顾客诊断信息管理</title>
	<meta name="decorator" content="default"/>
</head>
<body>
	<div data-role="navbar">
		<ul>
			<li><a href="${ctx}/base/customer/detail?id=${customerId}&emsId=${emsId}">客户基本资料</a></li>
			<li><a href="#" class="ui-btn-active">专家方案</a></li>
			<li><a href="${ctx}/base/customer/cards">客户卡信息</a></li>
			<li><a href="${ctx}/base/customer/consume">客户卡消费记录</a></li>
		</ul>
	</div>
	<form:form id="searchForm" modelAttribute="customerExam" action="${ctx}/expert/customerExam/" method="post">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
	</form:form>
	<div class="form-input">
	<tags:message content="${message}"/>
	<div class="icon-buttons">
		<a id="returnBtn" class="leave-detail" data-role="button" data-inline="true" data-icon="back" data-iconpos="notext"  href="#">返 回</a>
	</div>
	<br/>
	<h3 class="middleCls">专家方案列表</h3>
	<table id="contentTable" data-role="table" class="ui-responsive table-stroke">
		<thead><tr><th>诊断时间</th><th>美容师</th><th>状态</th></tr></thead>
		<tbody>
		<c:if test="${empty page.list}">
			<tr>
				<td colspan="3">无记录</td>
			</tr>
		</c:if>
		<c:if test="${not empty page.list}">
			<c:forEach items="${page.list}" var="customerExam">
				<tr id="${customerExam.id}" status="${showMap[customerExam.id] != 0}">
					<td>${fns:formatDate(customerExam.exam_time, "yyyy-MM-dd")}</td>
					<td>${customerExam.employee.name}</td>
					<td>
						<c:if test="${showMap[customerExam.id] == 0}">
							<c:if test="${customerExam.storeConsume != null}">
		    					已付款
							</c:if>
							<c:if test="${customerExam.storeConsume == null}" >
		    					未付款
							</c:if>
						</c:if>
						<c:if test="${showMap[customerExam.id] != 0}">
							<font style="color:red;">未确认</font>
						</c:if>
					</td>
				</tr>
			</c:forEach>
		</c:if>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	</div>
	<script type="text/javascript">
		$(document).ready(function() {	
			$("#contentTable tbody tr").click(function(){
				if (!this.id){
					return;
				}
				sessionStorage.parentPageNo = $("#pageNo").val();
				$(".opreationTR").removeClass("opreationTR");
				$(this).addClass("opreationTR");
				if ($(this).attr("status") == "true") {
					showTip("此次诊断客户没有确认，无法查看诊断明细！");
					return;
				}
				sessionStorage.parentPageNo = $("#pageNo").val();
				sessionStorage.urlTarget = 'detail';
				window.location.href ="${ctx}/expert/customerExam/detailResult?id=" + this.id + "&target=" + sessionStorage.urlTarget;
			});
			//离开本模块时,清除使用过的session
			$(".leave-detail").click(function(){
				var target = this.href;
				var url = "${ctx}/cleanSession?sessionKeys=emsId,customerId";
				var backFun = function(){
					window.location.href = target;
		 		};
		 		syncToServer(url, backFun);
				return false;
			});
			var currentSelectId = '${currentSelectId}';
			if(currentSelectId){
				$("#"+currentSelectId).addClass("opreationTR");
			} else {
				$("#contentTable tbody tr:first-child").addClass("opreationTR");
			}
			initCustomerDetailReturnButton("${ctx}", "${emsId}", "${customerId}");
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</body>
</html>
